
do "..\First.do"

* This file keeps high school GPAs for the whole population. 
* This dataset is later merged with PCPs
**********************************************************************************

clear
use "$raw\All_GRADES"

g hfaudd=audd
tostring hfaudd, replace
merge m:1 hfaudd using "...\formats\udd_kode.dta"
drop _merge

keep if udd_kode=="20" // Keep high school grades

bys pnr: egen first=min(karakter_udd_vtil)
drop if karakter_udd_vtil!=first

cap drop N
bys pnr: g N=_N
tab N
drop if N>1

keep pnr karakter_udd audd skala

save "$work\gp_grades.dta", replace






